package main;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GraphicsConfiguration;
import java.awt.List;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Vector;

import javax.swing.*;


public class Add_FLUX  extends JComponent {
	
static JLabel Ltab,lcolum, Debit, coloms;

static JTextField ttab,tColum,tdebit;
static JButton Colum_plus,Flux_val,finish;

static int COunt_tab=0;
static List list_TUP;
static Vector<String> vec_colom = new Vector<String>();
static Vector<String> vec_colom1 = new Vector<String>();
static Vector<String> rowOne = new Vector<String>();
static Vector<Integer> rowtow = new Vector<Integer>();
static Vector<String> rowTri = new Vector<String>();
static JTable table;
	static JFrame frame;
	public static void Add_FLUX(GraphicsConfiguration gConfig) {
		// TODO Auto-generated method stub
frame = new JFrame(gConfig);
frame.setSize(400,400);
frame.setVisible(true);
frame.setLayout(null);
frame.getContentPane().setBackground(new Color(200,200,242));

Ltab=new JLabel("Nom_table");
lcolum=new JLabel("Nom_Colum");
Debit=new JLabel("Dbit_flux");
ttab=new JTextField();
tColum=new JTextField();
tdebit=new JTextField();
Colum_plus=new JButton("+");
Flux_val=new JButton("valider");
finish=new JButton("finir");
coloms=new JLabel("");
Ltab.setBounds(30, 30, 80, 30);
ttab.setBounds(120, 30, 120, 30);

lcolum.setBounds(30, 110, 80, 30);
tColum.setBounds(120, 110, 80, 30);

Debit.setBounds(30, 70, 80, 30);
tdebit.setBounds(120,70, 120, 30);

Colum_plus.setBounds(200, 110, 50, 30);
coloms.setBounds(30, 150, 200, 30);
Flux_val.setBounds(30,190,200,30);
finish.setBounds(30,220,200,30);

list_TUP=new List();
rowOne.add("");rowtow.add(0);rowTri.add("");
JScrollPane scrollPane = new JScrollPane(list_TUP);
scrollPane.setBounds(350, 50, 200, 200);
frame.add(scrollPane);


frame.add(Ltab);frame.add(lcolum);frame.add(Debit);
frame.add(ttab);frame.add(tColum);frame.add(tdebit);
frame.add(Colum_plus);frame.add(coloms);frame.add(Flux_val);
frame.add(finish);



Colum_plus.addActionListener(new ActionListener(){

	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		String les_colone="";
		vec_colom.add(tColum.getText());
		vec_colom1.add(tColum.getText());
		coloms.setText( ttab.getText()+":"); 
		for(int i=0;i<=vec_colom1.size()-1;i++)
			 les_colone=les_colone+","+vec_colom1.elementAt(i);
			coloms.setText( coloms.getText()+","+les_colone);
		
	}
	
});
Flux_val.addActionListener(new ActionListener(){

	@SuppressWarnings("unchecked")
	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		list_TUP.add(coloms.getText());
		fram_pan2.list.add(coloms.getText());
		rowOne.add(ttab.getText());
		rowtow.add(vec_colom.size());
		rowTri.add(tdebit.getText());
		coloms.setText("");
		ttab.setText("");
		tColum.setText("");
		vec_colom1.clear();
		
		
	
		
	}
	
});
finish.addActionListener(new ActionListener(){

	@SuppressWarnings("unchecked")
	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		frame.setVisible(false);
		fram_pan2.layeredMethodelist.setVisible(true);
		
		
		
	
		
	}
	
});

	
}
	
}